package com.api.oa.services.impl;

import com.api.oa.mapper.${entityName}Mapper;
import com.api.oa.model.entity.${entityName};
import com.api.oa.model.vo.OaOrgTreeVO;
import com.api.oa.services.${entityName}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;


@Service
public class ${entityName}ServiceImpl implements ${entityName}Service {

    @Autowired
    private ${entityName}Mapper mapper;


    @Override
    public Integer add(${entityName} entity) {
        return mapper.insert(entity);
    }

    @Override
    public void remove(Long id) {
        mapper.delete(id);
    }

    @Override
    public Integer update(${entityName} entity) {
        return mapper.update(entity);
    }

    @Override
    public PageInfo<${entityName}> list(Long pid,Integer pageIndex,Integer pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        PageHelper.orderBy("createdAt desc");
        return new PageInfo<>(mapper.list(pid));
    }

    @Override
    public ${entityName} one(Long id) {
     return mapper.findOne(id);
    }



}
